home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_weap_imp1.cog < prev    next >
Text File  |  1999-11-15  |  5KB  |  220 lines

  1. # Jones 3D Cog Script
  2. #
  3. # weap_IMP1.cog
  4. #
  5. # [RT]
  6. #
  7. # Controls Infernal Machine Part #1, the Rumbler.
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ===================================================================
  12.  
  13. symbols
  14.  
  15. message        startup
  16. message        fire
  17. message        activated
  18. message        deactivated
  19. message        selected
  20. message        deselected
  21. message        callback
  22. message        timer
  23. message        changed
  24. message        user0
  25.  
  26. model        impOn=imp1_vibrat_on.3do    local    # Autoloaded
  27. model        impOff=imp1_vibrat.3do        local    # Autoloaded
  28.  
  29. sound        pull=gen_grenade_pull.wav    local    # Autoloaded
  30. sound        put=gen_grenade_put.wav        local    # Autoloaded
  31. sound        pow=imp1_chargeup.wav        local    # Autoloaded
  32. sound        on=imp1_powerup.wav            local    # Autoloaded
  33. sound        off=imp1_powerdown.wav        local    # Autoloaded
  34. sound        loop=imp1_on_loop.wav        local    # Autoloaded
  35.  
  36. template    prjctle_long=+imp1_long        local    # Autoloaded
  37. template    projectile=+imp1            local    # Autoloaded
  38. template    imp1_Fire=+imp1_fire        local    # Autoloaded
  39. template    imp1_Glow=+imp1_glow        local    # Autoloaded
  40.  
  41. thing        player                        local
  42. thing        bullet                        local
  43. thing        glow                        local
  44.  
  45. int            n_bulletSize                local
  46.  
  47. int            weaponNum=14                local
  48. int            handMesh                    local
  49. int            handNode                    local
  50. int            callNum                        local
  51. int            curSound                    local
  52. int            index                        local
  53.  
  54. int            bDisabled=0                    local
  55.  
  56. vector        firePos                        local
  57. vector        dustPos                        local
  58.  
  59. end
  60.  
  61. # ===================================================================
  62.  
  63. code
  64.  
  65. startup:
  66.  
  67.     player = GetLocalPlayerThing();
  68.     handMesh = GetMeshByName(player, "inrhand");
  69.     handNode = GetNodeByName(player, "inrhand");
  70.  
  71.     n_bulletSize = 0;
  72.  
  73.     return;
  74.  
  75. # -------------------------------------------------------------------
  76.  
  77. fire:
  78.  
  79.     if (bDisabled)
  80.     {
  81.         bDisabled = 0;
  82.         return;
  83.     }
  84.  
  85.     SetThingMesh(player, handMesh, impOn, 0);
  86.  
  87.     firePos = GetThingJointPos(player, handNode);
  88.  
  89.     if ( n_bulletSize == 0 )
  90.     {
  91.         bullet = FireProjectile(player, projectile, pow, -1, firePos, '0 0 0', 1.0, 0x0, 0.0, 0.0);
  92.     }
  93.     else
  94.     {
  95.         bullet = FireProjectile(player, prjctle_long, pow, -1, firePos, '0 0 0', 1.0, 0x0, 0.0, 0.0);
  96.     }
  97.     if (bullet != -1)
  98.     {
  99.         CreateThing(imp1_Fire, bullet);
  100.     }
  101.  
  102.     dustPos = GetThingJointPos(player, handNode);
  103.     dustPos = VectorAdd(dustPos, '0 0 0.035'); 
  104.     for(index = 0; index < 5; index = index + 1)
  105.     {
  106.         MakeFairyDust(player, dustPos);
  107.     }
  108.  
  109.     IMPStartFiring(14);
  110.  
  111.     SetFireWait(player, 1.5);
  112.     SetTimer(0.3);
  113.  
  114.     return;
  115.  
  116. # -------------------------------------------------------------------
  117.  
  118. activated:
  119.  
  120.     ActivateWeapon(player, 0.01);
  121.     return;
  122.  
  123. # -------------------------------------------------------------------
  124.  
  125. deactivated:
  126.  
  127.     DeactivateWeapon(player);
  128.     return;
  129.  
  130. # -------------------------------------------------------------------
  131.  
  132. selected:
  133.  
  134.     SetAimWait(player, 0.0);
  135.     SetMountWait(player, 0.7);
  136.  
  137.     SetArmedMode(player, 5);
  138.     SetCurWeapon(player, weaponNum);
  139.     SetThingFireOffset(player, '0.0 0.0 0.03'); 
  140.  
  141.     CaptureThing(player);
  142.     PlayMode(player, 66, 0);
  143.  
  144.     return;
  145.  
  146. # -------------------------------------------------------------------
  147.  
  148. deselected:
  149.  
  150.     SetMountWait(player, 1.0);
  151.     StopMode(player, 66, 0);
  152.  
  153.     CaptureThing(player);
  154.     PlayMode(player, 67, 0);
  155.  
  156.     SetArmedMode(player, 0);
  157.  
  158.     StopSound(curSound, 0.0);
  159.     PlaySoundThing(off, player, 1, -1, -1, 0x880);
  160.  
  161.     return;
  162.  
  163. # -------------------------------------------------------------------
  164.  
  165. callback:
  166.  
  167.     callNum = GetParam(1);
  168.     ReleaseThing(player);
  169.  
  170.     if (callNum == 28)
  171.     {
  172.         # Model swaps & FX
  173.         SetWeaponModel(player, weaponNum);
  174.         glow = AttachThingToThingMesh(player, imp1_Glow, handMesh);
  175.         
  176.         # Sounds
  177.         PlaySoundThing(pull, player, 1, -1, -1, 0x880);
  178.         PlaySoundThing(on, player, 1, -1, -1, 0x880);
  179.         Sleep(0.5);
  180.         curSound = PlaySoundThing(loop, player, 1, -1, -1, 0x881);
  181.     }
  182.     else if (callNum == 29)
  183.     {
  184.         # Cleanup...
  185.         ResetWeaponModel(player);
  186.         DetachThingMesh(glow);
  187.  
  188.         PlaySoundThing(put, player, 1, -1, -1, 0x880);
  189.     }
  190.  
  191.     return;
  192.  
  193. # -------------------------------------------------------------------
  194.  
  195. timer:
  196.  
  197.     SetThingMesh(player, handMesh, impOff, 0);
  198.     IMPEndFiring(14);
  199.     return;
  200.  
  201. # -------------------------------------------------------------------
  202.  
  203. changed:
  204.  
  205.     # This message is called when an IMP is activated on an IMP stand
  206.     bDisabled = 1;
  207.     return;
  208.  
  209. # -------------------------------------------------------------------
  210.  
  211. user0:
  212.     # This message sent to select a range for IMP1 projectiles
  213.     #    DEBUGFLEX(n_bulletSize, "IMP1 projectile size set to");
  214.  
  215.     n_bulletSize = GetParam(0);
  216.  
  217.     return;
  218.  
  219. end
  220.